package com.flong.kotlin.modules.controller

import com.flong.kotlin.core.PageVO
import com.flong.kotlin.modules.entity.User
import com.flong.kotlin.modules.query.UserQuery
import com.flong.kotlin.modules.service.UserService
import com.flong.kotlin.modules.vo.resp.UserRespVo
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.ResponseBody
@Controller
@RequestMapping("/rest")
open class UserController{
	
    @Autowired private lateinit var userService: UserService
 
	@ResponseBody
	@RequestMapping("/list1")
    fun list1():  String{
		return "NewFile" //跳转页面
    }
	
    @ResponseBody
	@RequestMapping("/add")
    fun add():  Unit{
		userService.addUser()
    }
	
	@ResponseBody
	@RequestMapping("/getUserId")
    fun getUserId(userId :Long):User?{
		return userService.getUserId(userId)
    }
	@ResponseBody
	@RequestMapping("/queryAllUser")
    fun queryAllUser():List<User>?{
		return userService.queryAllUser()
    }
	
    @ResponseBody
	@RequestMapping("listPage")
    fun listPage( query :UserQuery) :PageVO<UserRespVo> ? {
    	var listPage = userService.listPage(query);
        return listPage;
    }
	
	
}